﻿var city = {
    GetProvince:function(){
        var selProvince=document.getElementById("selProvince");
        var selCity=document.getElementById("selCity");
        selCity.options.length=0;
        selCity.options.add(new Option("请选择",""));
        var province=city.getProvinceCodesName;
        selProvince.options.length=0;       
        selProvince.options.add(new Option("请选择",""));
        if(province!=null)
        {
            for(var i=0;i<province.length;i++){
                var infos=province[i].split('_');
                selProvince.options.add(new Option(infos[1],infos[0]));
            }
        }
    },
    GetProvince:function(pid){
        var selProvince=document.getElementById("selProvince");
        var selCity=document.getElementById("selCity");
        selCity.options.length=0;
        selCity.options.add(new Option("请选择",""));
        var province=city.getProvinceCodesName;
        selProvince.options.length=0;       
        selProvince.options.add(new Option("请选择",""));
        if(province!=null)
        {
            for(var i=0;i<province.length;i++){
                var infos=province[i].split('_');
                selProvince.options.add(new Option(infos[1],infos[0]));
                if(infos[0]==pid){selProvince.options[selProvince.options.length-1].selected='selected';}
            }
        }
    },
    getProvinceCodesName:new Array('1_北京','2_天津','3_河北','4_山西','5_内蒙古','6_辽宁','7_吉林','8_黑龙江','9_上海','10_江苏','11_浙江','12_安徽','13_福建','14_江西','15_山东','16_河南','17_湖北','18_湖南','19_广东','20_广西','21_海南','22_重庆','23_四川','24_贵州','25_云南','26_西藏','27_陕西','28_甘肃','29_青海','30_宁夏','31_新疆','32_台湾','33_香港','34_澳门','379_海外'),
    GetCity : function(pid){
        var citys=city.getCityItems(pid);
        var selCity=document.getElementById("selCity");
        selCity.options.length=0;
        selCity.options.add(new Option("请选择",""));
        if(citys!=null)
        {
            for(var i=0;i<citys.length;i++){
                var infos=citys[i].split('_');
                selCity.options.add(new Option(infos[2],infos[0]));
            }
        }
    },
    GetCity : function(pid,cid){
        var citys=city.getCityItems(pid);
        var selCity=document.getElementById("selCity");
        selCity.options.length=0;
        selCity.options.add(new Option("请选择",""));
        if(citys!=null)
        {
            for(var i=0;i<citys.length;i++){
                var infos=citys[i].split('_');
                selCity.options.add(new Option(infos[2],infos[0]));
                if(infos[0]==cid){selCity.options[selCity.options.length-1].selected='selected';}
            }
        }
    },
    getCityItems : function(pid){
        var city = Array('32_32_台湾','33_33_香港','34_34_澳门','39_3_石家庄','40_3_唐山','41_3_秦皇岛','42_3_邯郸','43_3_邢台','44_3_保定','45_3_张家口','46_3_承德','47_3_沧州','48_3_廊坊','49_3_衡水','50_4_太原','51_4_大同','52_4_阳泉','53_4_长治','54_4_晋城','55_4_朔州','56_4_晋中','57_4_运城','58_4_忻州','59_4_临汾','60_4_吕梁','61_5_呼和浩特','62_5_包头','63_5_乌海','64_5_赤峰','65_5_通辽','66_5_鄂尔多斯','67_5_呼伦贝尔','68_5_巴彦淖尔','69_5_乌兰察布','70_5_兴安盟','71_5_锡林郭勒盟','72_5_阿拉善盟','73_6_沈阳','74_6_大连','75_6_鞍山','76_6_抚顺','77_6_本溪','78_6_丹东','79_6_锦州','80_6_营口','81_6_阜新','82_6_辽阳','83_6_盘锦','84_6_铁岭','85_6_朝阳','86_6_葫芦岛','87_7_长春','88_7_吉林','89_7_四平','90_7_辽源','91_7_通化','92_7_白山','93_7_松原','94_7_白城','95_7_延边','96_8_哈尔滨','97_8_齐齐哈尔','98_8_鸡西','99_8_鹤岗','100_8_双鸭山','101_8_大庆','102_8_伊春','103_8_佳木斯','104_8_七台河','105_8_牡丹江','106_8_黑河','107_8_绥化','108_8_大兴安岭','111_10_南京','112_10_无锡','113_10_徐州','114_10_常州','115_10_苏州','116_10_南通','117_10_连云港','118_10_淮安','119_10_盐城','120_10_扬州','121_10_镇江','122_10_泰州','123_10_宿迁','124_11_杭州','125_11_宁波','126_11_温州','127_11_嘉兴','128_11_湖州','129_11_绍兴','130_11_金华','131_11_衢州','132_11_舟山','133_11_台州','134_11_丽水','135_12_合肥','136_12_芜湖','137_12_蚌埠','138_12_淮南','139_12_马鞍山','140_12_淮北','141_12_铜陵','142_12_安庆','143_12_黄山','144_12_滁州','145_12_阜阳','146_12_宿州','147_12_巢湖','148_12_六安','149_12_亳州','150_12_池州','151_12_宣城','152_13_福州','153_13_厦门','154_13_莆田','155_13_三明','156_13_泉州','157_13_漳州','158_13_南平','159_13_龙岩','160_13_宁德','161_14_南昌','162_14_景德镇','163_14_萍乡','164_14_九江','165_14_新余','166_14_鹰潭','167_14_赣州','168_14_吉安','169_14_宜春','170_14_抚州','171_14_上饶','172_15_济南','173_15_青岛','174_15_淄博','175_15_枣庄','176_15_东营','177_15_烟台','178_15_潍坊','179_15_济宁','180_15_泰安','181_15_威海','182_15_日照','183_15_莱芜','184_15_临沂','185_15_德州','186_15_聊城','187_15_滨州','188_15_荷泽','189_16_郑州','190_16_开封','191_16_洛阳','192_16_平顶山','193_16_安阳','194_16_鹤壁','195_16_新乡','196_16_焦作','197_16_濮阳','198_16_许昌','199_16_漯河','200_16_三门峡','201_16_南阳','202_16_商丘','203_16_信阳','204_16_周口','205_16_驻马店','206_17_武汉','207_17_黄石','208_17_十堰','209_17_宜昌','210_17_襄樊','211_17_鄂州','212_17_荆门','213_17_孝感','214_17_荆州','215_17_黄冈','216_17_咸宁','217_17_随州','218_17_恩施','220_18_长沙','221_18_株洲','222_18_湘潭','223_18_衡阳','224_18_邵阳','225_18_岳阳','226_18_常德','227_18_张家界','228_18_益阳','229_18_郴州','230_18_永州','231_18_怀化','232_18_娄底','233_18_湘西','234_19_广州','235_19_韶关','236_19_深圳','237_19_珠海','238_19_汕头','239_19_佛山','240_19_江门','241_19_湛江','242_19_茂名','243_19_肇庆','244_19_惠州','245_19_梅州','246_19_汕尾','247_19_河源','248_19_阳江','249_19_清远','250_19_东莞','251_19_中山','252_19_潮州','253_19_揭阳','254_19_云浮','255_20_南宁','256_20_柳州','257_20_桂林','258_20_梧州','259_20_北海','260_20_防城港','261_20_钦州','262_20_贵港','263_20_玉林','264_20_百色','265_20_贺州','266_20_河池','267_20_来宾','268_20_崇左','269_21_海口','270_21_三亚','275_23_成都','276_23_自贡','277_23_攀枝花','278_23_泸州','279_23_德阳','280_23_绵阳','281_23_广元','282_23_遂宁','283_23_内江','284_23_乐山','285_23_南充','286_23_眉山','287_23_宜宾','288_23_广安','289_23_达州','290_23_雅安','291_23_巴中','292_23_资阳','293_23_阿坝','294_23_甘孜','295_23_凉山','296_24_贵阳','297_24_六盘水','298_24_遵义','299_24_安顺','300_24_铜仁','301_24_黔西南','302_24_毕节','303_24_黔东南','304_24_黔南','305_25_昆明','306_25_曲靖','307_25_玉溪','308_25_保山','309_25_昭通','310_25_丽江','311_25_思茅','312_25_临沧','313_25_楚雄','314_25_红河','315_25_文山','316_25_西双版纳','317_25_大理','318_25_德宏','319_25_怒江','320_25_迪庆','321_26_拉萨','322_26_昌都地','323_26_山南地','324_26_日喀则','325_26_那曲地','326_26_阿里','327_26_林芝','328_27_西安','329_27_铜川','330_27_宝鸡','331_27_咸阳','332_27_渭南','333_27_延安','334_27_汉中','335_27_榆林','336_27_安康','337_27_商洛','338_28_兰州','339_28_嘉峪关','340_28_金昌','341_28_白银','342_28_天水','343_28_武威','344_28_张掖','345_28_平凉','346_28_酒泉','347_28_庆阳','348_28_定西','349_28_陇南','350_28_临夏','351_28_甘南','352_29_西宁','353_29_海东','354_29_海北','355_29_黄南','356_29_海南','357_29_果洛','358_29_玉树','359_29_海西','360_30_银川','361_30_石嘴山','362_30_吴忠','363_30_固原','364_30_中卫','365_31_乌鲁木齐','366_31_克拉玛依','367_31_吐鲁番','368_31_哈密','369_31_昌吉回族','370_31_博尔塔拉','371_31_巴音郭楞','372_31_阿克苏','373_31_克孜勒苏','374_31_喀什','375_31_和田','376_31_伊犁','377_31_塔城','378_31_阿勒泰','380_379_美国','381_379_英国','382_379_法国','383_379_德国','384_379_意大利','385_379_瑞士','386_379_西班牙','387_379_葡萄牙','388_379_俄罗斯','389_379_日本','390_379_韩国','391_379_澳大利亚','392_379_新加坡','393_379_印度','394_379_马来西亚','395_379_印度尼西亚','396_379_巴基斯坦','397_379_巴西','398_379_墨西哥','399_379_阿根廷','400_379_智利','401_379_加拿大','402_379_其它','403_1_东城','404_1_西城','405_1_崇文','406_1_宣武','407_1_朝阳','408_1_丰台','409_1_石景山','410_1_海淀','411_1_门头沟','412_1_房山','413_1_通州','414_1_顺义','415_1_昌平','416_1_大兴','417_1_怀柔','418_1_平谷','419_1_密云','420_1_延庆','421_9_黄埔','422_9_卢湾','423_9_徐汇','424_9_长宁','425_9_静安','426_9_普陀','427_9_闸北','428_9_虹口','429_9_杨浦','430_9_宝山','431_9_闵行','432_9_嘉定','433_9_浦东新区','434_9_松江','435_9_金山','436_9_青浦','437_9_南汇','438_9_奉贤','439_9_崇明','441_2_和平','442_2_河东','443_2_河西','444_2_南开','445_2_河北','446_2_红桥','447_2_塘沽','448_2_汉沽','449_2_大港','450_2_东丽','451_2_西青','452_2_北辰','453_2_津南','454_2_武清','455_2_宝坻','456_2_静海','457_2_宁河','458_2_蓟县','459_22_渝中','460_22_大渡口','461_22_江北','462_22_沙坪坝','463_22_九龙坡','464_22_南岸','465_22_北碚','466_22_万盛','467_22_双桥','468_22_渝北','469_22_巴南','470_22_万州','471_22_涪陵','472_22_黔江','473_22_长寿','474_22_永川市','475_22_合川市','476_22_江津市','477_22_南川市','478_22_綦江','479_22_潼南','480_22_荣昌','481_22_璧山','482_22_大足','483_22_铜梁','484_22_梁平','485_22_城口','486_22_垫江','487_22_武隆','488_22_丰都','489_22_奉节','490_22_开县','491_22_云阳','492_22_忠县','493_22_巫峡','494_22_巫山','495_22_石柱','496_22_秀山','497_22_酉阳','498_22_彭水');
        var itemcity = new Array();
        for(var i=0;i<city.length;i++){
            var infos=city[i].split('_');
            if(infos[1]==pid){
                itemcity.push(city[i]);
            }
        }
        return itemcity;
    }
}